home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
public
/
rayshade
/
libray
/
libobj
/
bounds.s
< prev
next >
Wrap
Text File
|
1994-08-01
|
14KB
|
837 lines
.verstamp 3 18
.option pic2
.rdata
.align 2
.align 0
$$17:
.ascii "\X09X: %f to %f\X0A\X00"
.rdata
.align 2
.align 0
$$18:
.ascii "\X09Y: %f to %f\X0A\X00"
.rdata
.align 2
.align 0
$$19:
.ascii "\X09Z: %f to %f\X0A\X00"
.text
.align 2
.file 2 "bounds.c"
.globl BoundsIntersect
.loc 2 49
# 49 {
.ent BoundsIntersect 2
BoundsIntersect:
.option O2
.set noreorder
.cpload $25
.set reorder
subu $sp, 16
s.d $f20, 8($sp)
.fmask 0x00300000, -8
.frame $sp, 16, $31
mtc1 $7, $f14
mtc1 $6, $f15
lw $6, 32($sp)
.loc 2 49
.loc 2 53
# 50 Float t, tmin, tmax;
# 51 Float dir, pos;
# 52
# 53 tmax = *maxdist;
l.d $f2, 0($6)
mov.d $f0, $f2
.loc 2 54
# 54 tmin = mindist;
mov.d $f12, $f14
.loc 2 56
# 55
# 56 dir = ray->dir.x;
l.d $f16, 24($4)
.loc 2 57
# 57 pos = ray->pos.x;
l.d $f18, 0($4)
.loc 2 59
# 58
# 59 if (dir < 0) {
li.d $f4, 0.0000000000000000e+00
c.lt.d $f16, $f4
bc1f $35
.loc 2 59
.loc 2 60
# 60 t = (bounds[LOW][X] - pos) / dir;
l.d $f6, 0($5)
sub.d $f8, $f6, $f18
div.d $f20, $f8, $f16
.loc 2 61
# 61 if (t < tmin)
c.lt.d $f20, $f14
bc1f $32
.loc 2 62
# 62 return FALSE;
move $2, $0
b $64
$32:
.loc 2 63
# 63 if (t <= tmax)
c.le.d $f20, $f0
bc1f $33
.loc 2 64
# 64 tmax = t;
mov.d $f0, $f20
$33:
.loc 2 65
# 65 t = (bounds[HIGH][X] - pos) / dir;
l.d $f10, 24($5)
sub.d $f4, $f10, $f18
div.d $f20, $f4, $f16
.loc 2 66
# 66 if (t >= tmin) {
c.le.d $f14, $f20
bc1f $41
.loc 2 66
.loc 2 67
# 67 if (t > tmax)
c.lt.d $f0, $f20
bc1f $34
.loc 2 68
# 68 return FALSE;
move $2, $0
b $64
$34:
.loc 2 69
# 69 tmin = t;
mov.d $f12, $f20
b $41
$35:
.loc 2 71
# 70 }
# 71 } else if (dir > 0.) {
li.d $f6, 0.
c.lt.d $f6, $f16
bc1f $39
.loc 2 71
.loc 2 72
# 72 t = (bounds[HIGH][X] - pos) / dir;
l.d $f8, 24($5)
sub.d $f10, $f8, $f18
div.d $f20, $f10, $f16
.loc 2 73
# 73 if (t < tmin)
c.lt.d $f20, $f14
bc1f $36
.loc 2 74
# 74 return FALSE;
move $2, $0
b $64
$36:
.loc 2 75
# 75 if (t <= tmax)
c.le.d $f20, $f0
bc1f $37
.loc 2 76
# 76 tmax = t;
mov.d $f0, $f20
$37:
.loc 2 77
# 77 t = (bounds[LOW][X] - pos) / dir;
l.d $f4, 0($5)
sub.d $f6, $f4, $f18
div.d $f20, $f6, $f16
.loc 2 78
# 78 if (t >= tmin) {
c.le.d $f14, $f20
bc1f $41
.loc 2 78
.loc 2 79
# 79 if (t > tmax)
c.lt.d $f0, $f20
bc1f $38
.loc 2 80
# 80 return FALSE;
move $2, $0
b $64
$38:
.loc 2 81
# 81 tmin = t;
mov.d $f12, $f20
b $41
$39:
.loc 2 83
# 82 }
# 83 } else if (pos < bounds[LOW][X] || pos > bounds[HIGH][X])
l.d $f8, 0($5)
c.lt.d $f18, $f8
bc1t $40
l.d $f10, 24($5)
c.lt.d $f10, $f18
bc1f $41
$40:
.loc 2 84
# 84 return FALSE;
move $2, $0
b $64
$41:
.loc 2 86
# 85
# 86 dir = ray->dir.y;
l.d $f16, 32($4)
.loc 2 87
# 87 pos = ray->pos.y;
l.d $f18, 8($4)
.loc 2 89
# 88
# 89 if (dir < 0) {
li.d $f4, 0.0000000000000000e+00
c.lt.d $f16, $f4
bc1f $45
.loc 2 89
.loc 2 90
# 90 t = (bounds[LOW][Y] - pos) / dir;
l.d $f6, 8($5)
sub.d $f8, $f6, $f18
div.d $f20, $f8, $f16
.loc 2 91
# 91 if (t < tmin)
c.lt.d $f20, $f12
bc1f $42
.loc 2 92
# 92 return FALSE;
move $2, $0
b $64
$42:
.loc 2 93
# 93 if (t <= tmax)
c.le.d $f20, $f0
bc1f $43
.loc 2 94
# 94 tmax = t;
mov.d $f0, $f20
$43:
.loc 2 95
# 95 t = (bounds[HIGH][Y] - pos) / dir;
l.d $f10, 32($5)
sub.d $f4, $f10, $f18
div.d $f20, $f4, $f16
.loc 2 96
# 96 if (t >= tmin) {
c.le.d $f12, $f20
bc1f $51
.loc 2 96
.loc 2 97
# 97 if (t > tmax)
c.lt.d $f0, $f20
bc1f $44
.loc 2 98
# 98 return FALSE;
move $2, $0
b $64
$44:
.loc 2 99
# 99 tmin = t;
mov.d $f12, $f20
b $51
$45:
.loc 2 101
# 100 }
# 101 } else if (dir > 0.) {
li.d $f6, 0.
c.lt.d $f6, $f16
bc1f $49
.loc 2 101
.loc 2 102
# 102 t = (bounds[HIGH][Y] - pos) / dir;
l.d $f8, 32($5)
sub.d $f10, $f8, $f18
div.d $f20, $f10, $f16
.loc 2 103
# 103 if (t < tmin)
c.lt.d $f20, $f12
bc1f $46
.loc 2 104
# 104 return FALSE;
move $2, $0
b $64
$46:
.loc 2 105
# 105 if (t <= tmax)
c.le.d $f20, $f0
bc1f $47
.loc 2 106
# 106 tmax = t;
mov.d $f0, $f20
$47:
.loc 2 107
# 107 t = (bounds[LOW][Y] - pos) / dir;
l.d $f4, 8($5)
sub.d $f6, $f4, $f18
div.d $f20, $f6, $f16
.loc 2 108
# 108 if (t >= tmin) {
c.le.d $f12, $f20
bc1f $51
.loc 2 108
.loc 2 109
# 109 if (t > tmax)
c.lt.d $f0, $f20
bc1f $48
.loc 2 110
# 110 return FALSE;
move $2, $0
b $64
$48:
.loc 2 111
# 111 tmin = t;
mov.d $f12, $f20
b $51
$49:
.loc 2 113
# 112 }
# 113 } else if (pos < bounds[LOW][Y] || pos > bounds[HIGH][Y])
l.d $f8, 8($5)
c.lt.d $f18, $f8
bc1t $50
l.d $f10, 32($5)
c.lt.d $f10, $f18
bc1f $51
$50:
.loc 2 114
# 114 return FALSE;
move $2, $0
b $64
$51:
.loc 2 116
# 115
# 116 dir = ray->dir.z;
l.d $f16, 40($4)
.loc 2 117
# 117 pos = ray->pos.z;
l.d $f18, 16($4)
.loc 2 119
# 118
# 119 if (dir < 0) {
li.d $f4, 0.0000000000000000e+00
c.lt.d $f16, $f4
bc1f $55
.loc 2 119
.loc 2 120
# 120 t = (bounds[LOW][Z] - pos) / dir;
l.d $f6, 16($5)
sub.d $f8, $f6, $f18
div.d $f20, $f8, $f16
.loc 2 121
# 121 if (t < tmin)
c.lt.d $f20, $f12
bc1f $52
.loc 2 122
# 122 return FALSE;
move $2, $0
b $64
$52:
.loc 2 123
# 123 if (t <= tmax)
c.le.d $f20, $f0
bc1f $53
.loc 2 124
# 124 tmax = t;
mov.d $f0, $f20
$53:
.loc 2 125
# 125 t = (bounds[HIGH][Z] - pos) / dir;
l.d $f10, 40($5)
sub.d $f4, $f10, $f18
div.d $f20, $f4, $f16
.loc 2 126
# 126 if (t >= tmin) {
c.le.d $f12, $f20
bc1f $61
.loc 2 126
.loc 2 127
# 127 if (t > tmax)
c.lt.d $f0, $f20
bc1f $54
.loc 2 128
# 128 return FALSE;
move $2, $0
b $64
$54:
.loc 2 129
# 129 tmin = t;
mov.d $f12, $f20
b $61
$55:
.loc 2 131
# 130 }
# 131 } else if (dir > 0.) {
li.d $f6, 0.
c.lt.d $f6, $f16
bc1f $59
.loc 2 131
.loc 2 132
# 132 t = (bounds[HIGH][Z] - pos) / dir;
l.d $f8, 40($5)
sub.d $f10, $f8, $f18
div.d $f20, $f10, $f16
.loc 2 133
# 133 if (t < tmin)
c.lt.d $f20, $f12
bc1f $56
.loc 2 134
# 134 return FALSE;
move $2, $0
b $64
$56:
.loc 2 135
# 135 if (t <= tmax)
c.le.d $f20, $f0
bc1f $57
.loc 2 136
# 136 tmax = t;
mov.d $f0, $f20
$57:
.loc 2 137
# 137 t = (bounds[LOW][Z] - pos) / dir;
l.d $f4, 16($5)
sub.d $f6, $f4, $f18
div.d $f20, $f6, $f16
.loc 2 138
# 138 if (t >= tmin) {
c.le.d $f12, $f20
bc1f $61
.loc 2 138
.loc 2 139
# 139 if (t > tmax)
c.lt.d $f0, $f20
bc1f $58
.loc 2 140
# 140 return FALSE;
move $2, $0
b $64
$58:
.loc 2 141
# 141 tmin = t;
mov.d $f12, $f20
b $61
$59:
.loc 2 143
# 142 }
# 143 } else if (pos < bounds[LOW][Z] || pos > bounds[HIGH][Z])
l.d $f8, 16($5)
c.lt.d $f18, $f8
bc1t $60
l.d $f10, 40($5)
c.lt.d $f10, $f18
bc1f $61
$60:
.loc 2 144
# 144 return FALSE;
move $2, $0
b $64
$61:
.loc 2 150
# 145
# 146 /*
# 147 * If tmin == mindist, then there was no "near"
# 148 * intersection farther than EPSILON away.
# 149 */
# 150 if (tmin == mindist) {
c.eq.d $f12, $f14
bc1f $62
.loc 2 150
.loc 2 151
# 151 if (tmax < *maxdist) {
c.lt.d $f0, $f2
bc1f $63
.loc 2 151
.loc 2 152
# 152 *maxdist = tmax;
s.d $f0, 0($6)
.loc 2 153
# 153 return TRUE;
li $2, 1
b $64
$62:
.loc 2 155
# 154 }
# 155 } else {
.loc 2 156
# 156 if (tmin < *maxdist) {
c.lt.d $f12, $f2
bc1f $63
.loc 2 156
.loc 2 157
# 157 *maxdist = tmin;
s.d $f12, 0($6)
.loc 2 158
# 158 return TRUE;
li $2, 1
b $64
$63:
.loc 2 161
# 159 }
# 160 }
# 161 return FALSE; /* hit, but not closer than maxdist */
move $2, $0
$64:
.livereg 0x2000FF0E,0x00000FFF
l.d $f20, 8($sp)
addu $sp, 16
j $31
.end BoundsIntersect
.text
.align 2
.file 2 "bounds.c"
.globl BoundsTransform
.loc 2 172
# 172 {
.ent BoundsTransform 2
BoundsTransform:
.option O2
.set noreorder
.cpload $25
.set reorder
subu $sp, 152
sw $31, 36($sp)
.cprestore 32
sw $17, 28($sp)
sw $16, 24($sp)
.mask 0x90030000, -116
.frame $sp, 152, $31
move $16, $4
move $17, $5
.loc 2 172
.loc 2 179
# 179 if (objbounds[LOW][X] > objbounds[HIGH][X])
l.d $f4, 24($17)
l.d $f6, 0($17)
c.lt.d $f4, $f6
bc1t $69
.loc 2 180
# 180 return;
.loc 2 182
# 181
# 182 bounds[LOW][X] = bounds[HIGH][X] = trans->translate.x;
l.d $f0, 72($16)
s.d $f0, 128($sp)
s.d $f0, 104($sp)
.loc 2 183
# 183 bounds[LOW][Y] = bounds[HIGH][Y] = trans->translate.y;
l.d $f0, 80($16)
s.d $f0, 136($sp)
s.d $f0, 112($sp)
.loc 2 184
# 184 bounds[LOW][Z] = bounds[HIGH][Z] = trans->translate.z;
l.d $f0, 88($16)
s.d $f0, 144($sp)
s.d $f0, 120($sp)
.loc 2 186
# 185
# 186 for (i = 0; i < 3; i++) {
move $3, $0
move $7, $0
addu $2, $sp, 104
addu $9, $sp, 128
li $6, 24
$65:
.loc 2 186
.loc 2 187
# 187 for (j = 0; j < 3; j++) {
move $8, $0
move $4, $0
move $3, $17
addu $5, $16, $7
$66:
.loc 2 187
.loc 2 188
# 188 a = trans->matrix[j][i] * objbounds[LOW][j];
l.d $f0, 0($5)
l.d $f8, 0($3)
mul.d $f2, $f8, $f0
.loc 2 189
# 189 b = trans->matrix[j][i] * objbounds[HIGH][j];
l.d $f10, 24($3)
mul.d $f12, $f10, $f0
.loc 2 190
# 190 if (a < b) {
c.lt.d $f2, $f12
bc1f $67
.loc 2 190
.loc 2 191
# 191 bounds[LOW][i] += a;
.noalias $2,$gp
l.d $f16, 0($2)
add.d $f18, $f16, $f2
s.d $f18, 0($2)
.loc 2 192
# 192 bounds[HIGH][i] += b;
l.d $f4, 24($2)
add.d $f6, $f4, $f12
s.d $f6, 24($2)
b $68
$67:
.loc 2 193
# 193 } else {
.loc 2 194
# 194 bounds[LOW][i] += b;
l.d $f8, 0($2)
add.d $f10, $f8, $f12
s.d $f10, 0($2)
.loc 2 195
# 195 bounds[HIGH][i] += a;
l.d $f16, 24($2)
add.d $f18, $f16, $f2
s.d $f18, 24($2)
$68:
.loc 2 187
# 187 for (j = 0; j < 3; j++) {
addu $4, $4, 8
addu $3, $3, 8
addu $5, $5, 24
bne $4, $6, $66
.loc 2 186
# 186 for (i = 0; i < 3; i++) {
addu $7, $7, 8
addu $2, $2, 8
bne $2, $9, $65
.alias $2,$gp
.loc 2 199
# 199 BoundsCopy(bounds, objbounds);
addu $4, $sp, 104
move $5, $17
.livereg 0x0C00000E,0x00000000
jal BoundsCopy
.loc 2 200
# 200 }
$69:
.livereg 0x0000FF0E,0x00000FFF
lw $16, 24($sp)
lw $17, 28($sp)
lw $31, 36($sp)
addu $sp, 152
j $31
.end BoundsTransform
.text
.align 2
.file 2 "bounds.c"
.globl BoundsInit
.loc 2 205
# 201
# 202 void
# 203 BoundsInit(bounds)
# 204 Float bounds[2][3];
# 205 {
.ent BoundsInit 2
BoundsInit:
.option O2
.set noreorder
.cpload $25
.set reorder
.frame $sp, 0, $31
li.d $f0, 1.0E+14
li.d $f2, -1.0000000000000000e+14
.loc 2 205
.loc 2 206
# 206 bounds[LOW][X] = bounds[LOW][Y] = bounds[LOW][Z] = FAR_AWAY;
s.d $f0, 16($4)
s.d $f0, 8($4)
s.d $f0, 0($4)
.loc 2 207
# 207 bounds[HIGH][X] = bounds[HIGH][Y] = bounds[HIGH][Z] = -FAR_AWAY;
s.d $f2, 40($4)
s.d $f2, 32($4)
s.d $f2, 24($4)
.loc 2 208
# 208 }
.livereg 0x0000FF0E,0x00000FFF
j $31
.end BoundsInit
.text
.align 2
.file 2 "bounds.c"
.globl BoundsCopy
.loc 2 213
# 209
# 210 void
# 211 BoundsCopy(from, into)
# 212 Float into[2][3], from[2][3];
# 213 {
.ent BoundsCopy 2
BoundsCopy:
.option O2
.frame $sp, 0, $31
.loc 2 213
.loc 2 214
# 214 into[LOW][X] = from[LOW][X];
l.d $f4, 0($4)
s.d $f4, 0($5)
.loc 2 215
# 215 into[LOW][Y] = from[LOW][Y];
l.d $f6, 8($4)
s.d $f6, 8($5)
.loc 2 216
# 216 into[LOW][Z] = from[LOW][Z];
l.d $f8, 16($4)
s.d $f8, 16($5)
.loc 2 217
# 217 into[HIGH][X] = from[HIGH][X];
l.d $f10, 24($4)
s.d $f10, 24($5)
.loc 2 218
# 218 into[HIGH][Y] = from[HIGH][Y];
l.d $f16, 32($4)
s.d $f16, 32($5)
.loc 2 219
# 219 into[HIGH][Z] = from[HIGH][Z];
l.d $f18, 40($4)
s.d $f18, 40($5)
.loc 2 220
# 220 }
.livereg 0x0000FF0E,0x00000FFF
j $31
.end BoundsCopy
.text
.align 2
.file 2 "bounds.c"
.globl BoundsEnlarge
.loc 2 231
# 231 {
.ent BoundsEnlarge 2
BoundsEnlarge:
.option O2
.frame $sp, 0, $31
.loc 2 231
.loc 2 232
# 232 SetIfLess(old[LOW][X], new[LOW][X]);
l.d $f0, 0($4)
l.d $f2, 0($5)
c.lt.d $f0, $f2
bc1f $70
s.d $f0, 0($4)
b $71
$70:
s.d $f2, 0($4)
$71:
.loc 2 233
# 233 SetIfLess(old[LOW][Y], new[LOW][Y]);
l.d $f0, 8($4)
l.d $f2, 8($5)
c.lt.d $f0, $f2
bc1f $72
s.d $f0, 8($4)
b $73
$72:
s.d $f2, 8($4)
$73:
.loc 2 234
# 234 SetIfLess(old[LOW][Z], new[LOW][Z]);
l.d $f0, 16($4)
l.d $f2, 16($5)
c.lt.d $f0, $f2
bc1f $74
s.d $f0, 16($4)
b $75
$74:
s.d $f2, 16($4)
$75:
.loc 2 235
# 235 SetIfGreater(old[HIGH][X], new[HIGH][X]);
l.d $f0, 24($5)
l.d $f2, 24($4)
c.lt.d $f0, $f2
bc1f $76
s.d $f2, 24($4)
b $77
$76:
s.d $f0, 24($4)
$77:
.loc 2 236
# 236 SetIfGreater(old[HIGH][Y], new[HIGH][Y]);
l.d $f0, 32($5)
l.d $f2, 32($4)
c.lt.d $f0, $f2
bc1f $78
s.d $f2, 32($4)
b $79
$78:
s.d $f0, 32($4)
$79:
.loc 2 237
# 237 SetIfGreater(old[HIGH][Z], new[HIGH][Z]);
l.d $f0, 40($5)
l.d $f2, 40($4)
c.lt.d $f0, $f2
bc1f $80
s.d $f2, 40($4)
.livereg 0x0000FF0E,0x00000FFF
j $31
$80:
s.d $f0, 40($4)
.loc 2 238
# 238 }
$81:
.livereg 0x0000FF0E,0x00000FFF
j $31
.end BoundsEnlarge
.text
.align 2
.file 2 "bounds.c"
.globl BoundsPrint
.loc 2 244
# 239
# 240 void
# 241 BoundsPrint(box, fp)
# 242 Float box[2][3];
# 243 FILE *fp;
# 244 {
.ent BoundsPrint 2
BoundsPrint:
.option O2
.set noreorder
.cpload $25
.set reorder
subu $sp, 40
sw $31, 36($sp)
.cprestore 32
sw $16, 28($sp)
.mask 0x90010000, -4
.frame $sp, 40, $31
move $16, $4
sw $5, 44($sp)
.loc 2 244
.loc 2 245
# 245 fprintf(fp,"\tX: %f to %f\n",box[LOW][X], box[HIGH][X]);
lw $4, 44($sp)
la $5, $$17
ld $6, 0($16)
l.d $f4, 24($16)
s.d $f4, 16($sp)
.livereg 0x0F00000E,0x00000000
jal fprintf
.loc 2 246
# 246 fprintf(fp,"\tY: %f to %f\n",box[LOW][Y], box[HIGH][Y]);
lw $4, 44($sp)
la $5, $$18
ld $6, 8($16)
l.d $f6, 32($16)
s.d $f6, 16($sp)
.livereg 0x0F00000E,0x00000000
jal fprintf
.loc 2 247
# 247 fprintf(fp,"\tZ: %f to %f\n",box[LOW][Z], box[HIGH][Z]);
lw $4, 44($sp)
la $5, $$19
ld $6, 16($16)
l.d $f8, 40($16)
s.d $f8, 16($sp)
.livereg 0x0F00000E,0x00000000
jal fprintf
.loc 2 248
# 248 }
.livereg 0x0000FF0E,0x00000FFF
lw $16, 28($sp)
lw $31, 36($sp)
addu $sp, 40
j $31
.end BoundsPrint